﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Text;

public partial class Users_AddressManage : System.Web.UI.Page
{
    protected void Page_PreInit(object sender, EventArgs e)
    {
        Page.Theme = BLL.Common.GetWSThemes();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = BasePage.WebTitle;
        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {
            Init_Address();
        }
        else
        {
            Response.Redirect("Login.aspx");
        }
    }
    private void Init_Address()
    {
        StringBuilder TableName = new StringBuilder();
        StringBuilder FiledName = new StringBuilder();
        StringBuilder WhereStr = new StringBuilder();
        TableName.Append("V_CUSTOMER_ADDRESS");
        FiledName.Append(" id,");
        FiledName.Append("UserId,");
        FiledName.Append("Receiver,");
        FiledName.Append("Provice,");
        FiledName.Append("ProviceName=(select ProName from Province where V_CUSTOMER_ADDRESS.Provice=Province.ProID), ");
        FiledName.Append("City,");
        FiledName.Append("CityName=(select CityName from City where V_CUSTOMER_ADDRESS.City=City.CityID),");
        FiledName.Append("Area,");
        FiledName.Append("AreaName=(select Areaname from Area where V_CUSTOMER_ADDRESS.Area=Area.AreaID),");
        FiledName.Append("Address,");
        FiledName.Append("PostDM,");
        FiledName.Append("Tel, ");
        FiledName.Append("Mobile,");
        FiledName.Append(" IsDel,");
        FiledName.Append("AddTime");
        WhereStr.Append(" and IsDel=0 and [UserId] = '" + BasePage.GetValue(0) + "'");
        int pagecount, rowcount;
        Repeater1.DataSource = new BLL.V_CUSTOMER_ADDRESS().UserManage_address(TableName.ToString(), FiledName.ToString(), AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, "AddTime", true, WhereStr.ToString(), out pagecount, out rowcount);
        Repeater1.DataBind();
        AspNetPager1.RecordCount = rowcount;
    }
    protected void AspNetPager1_PageChanged1(object sender, EventArgs e)
    {

        Init_Address();
    }
}
